package de.shortys.myhome.api.view.components.toolbar;

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.util.Observable;

import javax.swing.JPanel;

public class ApplicationToolbar extends AbstractToolbar {

	private JPanel toolbarPane;

	public ApplicationToolbar() {
		toolbarPane = new JPanel();
		// toolbarPane.setBorder(BorderFactory.createLineBorder(Color.RED));
		toolbarPane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0));
		toolbarPane.setOpaque(false);
	}

	@Override
	public void update(Observable arg0, Object arg1) {

	}

	public AbstractToolbarItem add(AbstractToolbarItem item) {
		toolbarPane.add(item.build());
		return item;
	}

	@Override
	protected void buildComponents() {
		setPadding(5, 0, 5, 0);
		getContentPane().setLayout(new BorderLayout());
		getContentPane().add(toolbarPane);
	}

	@Override
	public void revalidate() {
		toolbarPane.revalidate();
		toolbarPane.repaint();
	}

	@Override
	public void remove(AbstractToolbarItem item) {
		toolbarPane.remove(item.build());
	}

	@Override
	public void clear() {
		// TODO Auto-generated method stub
		
	}

}
